From 7c82730aa2ff685712718c54cb1920cb7738e53a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 9 Nov 2005 07:56:39 +0000 Subject: [PATCH] * Forbid usernames that can be interpreted as titles with namespaces, as that leads to hard-to-manage names. --- RELEASE-NOTES | 2 ++ includes/User.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8dc3a02f9e..54fd1e91b7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -214,6 +214,8 @@ fully support the editing toolbar, but was found to be too confusing. localizable as 'datedefault' message. Tweaked lots of languages files... * Added local message cache feature ($wgLocalMessageCache), to reduce bandwidth requirements to the memcached server. +* Forbid usernames that can be interpreted as titles with namespaces, as that + leads to hard-to-manage names. === Caveats === diff --git a/includes/User.php b/includes/User.php index 5f570f40d3..1e3809d141 100644 --- a/includes/User.php +++ b/includes/User.php @@ -201,6 +201,14 @@ class User { || strlen( $name ) > $wgMaxNameChars || $name != $wgContLang->ucfirst( $name ) ) return false; + + // Ensure that the name can't be misresolved as a different title, + // such as with extra namespace keys at the start. + $parsed = Title::newFromText( $name ); + if( is_null( $parsed ) + || $parsed->getNamespace() + || strcmp( $name, $parsed->getPrefixedText() ) ) + return false; else return true; } -- 2.20.1